home *** CD-ROM | disk | FTP | other *** search
- define type city_budget ( internallength = 16,
- input = int44in,
- output = int44out,
- element = int4)
- \g
-
- create person (name = char16, age = int4, location = point)
- \g
- create emp (salary = int4, dept = char16) inherits (person)
- \g
- create student (gpa = float8) inherits (person)
- \g
- create stud_emp (percent = int4) inherits (emp, student)
- \g
- create dept (dname = char16, mgrname = char16)
- \g
- create city (name = char16, location = box, budget = city_budget)
- \g
-
- define function boxarea ( language = "c",
- returntype = int4)
- arg is (box)
- as "_CWD_/boxarea.o"
- \g
-
- define function overpaid ( language = "c",
- returntype = bool)
- arg is (emp)
- as "_CWD_/overpaid.o"
- \g
- load "_CWD_/overpaid.o"
- \g
- load "_CWD_/boxarea.o"
- \g
- append person (name = "mike", age = 40, location = "(3.1,6.2)"::point)
- \g
-
- append person (name = "joe", age = 20, location = "(5.5,2.5)"::point)
- \g
-
- append person (name = "greg", age = 50, location = "(5.0,2.0)"::point)
- \g
-
- append person (name = "bob", age = 18, location = "(0.0,0.0)"::point)
- \g
-
- append dept (dname = "toy", mgrname = "sharon")
- \g
-
- append dept (dname = "shoe", mgrname = "bob")
- \g
- append emp (name = "bill", age = 20,
- location = "(11.0,10.0)"::point, salary = 1000, dept = "toy")
- \g
- append emp (name = "sharon", age = 25,
- location = "(15.0,12.0)"::point, salary = 500, dept = "shoe")
- \g
- append emp (name = "sam", age = 30,
- location = "(10.0,5.0)"::point, salary = 300, dept = "toy")
- \g
- append student (name = "fred", age = 28, location = "(3.1,-1.5)"::point, gpa = 3.7)
- \g
- append student (name = "larry", age = 60, location = "(21.8,4.9)"::point, gpa = 3.1)
- \g
- append stud_emp (name = "jeff", age = 23,
- location = "(8.0,7.7)"::point, salary = 600, dept = "candy", gpa = 3.5)
- \g
- append stud_emp (name = "cim", age = 30, location = "(10.5,4.7)"::point,
- salary = 400, dept = "shoe", gpa = 3.4)
- \g
- append stud_emp (name = "linda", age = 19, location = "(0.9,6.1)"::point,
- salary = 100, dept = "candy", gpa = 2.9)
- \g
- append city (name = "berkeley", location = "(0.0,0.0,10.0,10.0)"::box,
- budget = "250, 300, 325, 275"::city_budget)
- \g
- append city (name = "oakland", location = "(-10.0,-10.0,0.0,5.0)"::box,
- budget = "600, 400, 350, 500"::city_budget)
- \g
- append city (name = "elcerrito", location = "(10.0,0.0, 20.0,10.0)"::box,
- budget = "100, 100, 100, 100"::city_budget)
- \g
- append city (name = "richmond", location = "(20.0,5.0, 35.0,15.0)"::box,
- budget = "300, 320, 340, 360"::city_budget)
- \g
- append city (name = "sanpablo", location = "(35.0,20.0,40.0,30.0)"::box,
- budget = "50, 60, 65, 70"::city_budget)
- \g
- create slow_emp4000 (location = box)
- \g
- create fast_emp4000 (location = box)
- \g
- copy slow_emp4000 from "_CWD_/rect_data"
- \g
- copy fast_emp4000 from "_CWD_/rect_data"
- \g
- define index rect2ind on fast_emp4000 using rtree (location bigbox_ops)
- \g
-